//获取包名
package com.codeyang.controller.system;/**
 * 描述: TO-删除标志-DO
 *
 * @author CodeYang_Site
 * @version 2021/5/5 22:09
 */
//设置一个实体变量获取我们输入的类名
//小驼峰变量

import com.codeyang.dto.LoginInfoDto;
import com.codeyang.service.LoginInfoService;
import com.codeyang.utils.AjaxResult;
import com.codeyang.vo.DataGridView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

// 取值 {实体变量名}

@RestController
@RequestMapping("/system/loginInfo")
public class LoginInfoController {

    @Autowired
    private LoginInfoService loginInfoService;

    /**
     * 分页查询
     *
     * @return
     */
    @GetMapping("/listForPage")
    public AjaxResult listForPage(LoginInfoDto loginInfoDto) {
        DataGridView dataGridView = loginInfoService.lisPage(loginInfoDto);
        return AjaxResult.success("数据加载成功", dataGridView.getData(), dataGridView.getTotal());
    }



    /**
     * 删除数据
     *
     * @param ids 根据id删除数据
     * @return 是否删除成功
     */
    @DeleteMapping("/deleteLoginInfoByIds/{ids}")
    public AjaxResult deleteLoginInfoByIds(@PathVariable("ids") Long[] ids) {
        boolean flag = loginInfoService.removeByIds(Arrays.asList(ids));
        return flag ? AjaxResult.success() : AjaxResult.fail("删除失败");
    }

    /**
     * 清空操作
     * @return
     */
    @DeleteMapping("/clearLoginInfo")
    public AjaxResult clearLoginInfo(){
        boolean flag = loginInfoService.remove(null);
        return flag ? AjaxResult.success() : AjaxResult.fail("清空失败");
    }




}
